package com.huirui.server.pojo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Schema(description = "详细订单信息VO，包含订单主信息及订单项明细")
public class HighlyDetailedOrderDetailVo {

    @Schema(description = "订单ID", example = "10001")
    private Long orderId;

    @Schema(description = "订单编号", example = "ORD202310200001")
    private String orderNumber;

    @Schema(description = "订单类型（1-普通订单，2-秒杀订单，3-团购订单）", example = "1")
    private Integer orderType;

    @Schema(description = "支付方式（1-微信支付，2-支付宝，3-银行卡）", example = "1")
    private Integer paymentMethod;

    @Schema(description = "订单状态")
    private Integer orderStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "支付时间", example = "2023-10-20T14:30:00")
    private LocalDateTime payTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "发货时间", example = "2023-10-20T16:45:00")
    private LocalDateTime deliveryTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "收货时间", example = "2023-10-22T09:15:00")
    private LocalDateTime receiveTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "取消时间（未取消则为null）", example = "2023-10-20T15:00:00")
    private LocalDateTime cancelTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "订单创建时间", example = "2023-10-20T14:00:00")
    private LocalDateTime createTime;

    @Schema(description = "用户ID", example = "10086")
    private Long userId;

    @Schema(description = "用户名", example = "张三")
    private String userName;

    @Schema(description = "绑定手机号", example = "13800138000")
    private String bindingPhoneNumber;

    @Schema(description = "收货人姓名", example = "李四")
    private String receiverName;

    @Schema(description = "收货人手机号", example = "13900139000")
    private String receiverPhoneNumber;

    @Schema(description = "收货地址", example = "北京市朝阳区某某街道100号")
    private String deliveryAddress;

    @Schema(description = "商品总数量", example = "3")
    private Long totalNumberOfProducts;

    @Schema(description = "订单总金额（未优惠前）", example = "999.00")
    private Double totalAmount;

    @Schema(description = "实际支付金额", example = "899.00")
    private Double actualPayment;

    @Schema(description = "客户备注信息", example = "请尽快发货")
    private String customerNote;

    @Schema(description = "商家备注信息", example = "已优先安排发货")
    private String merchantNote;

    @Schema(description = "用户性别（1-男，2-女，0-未知）", example = "1")
    private Integer userGender;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "用户注册时间", example = "2022-01-15T10:30:00")
    private LocalDateTime registrationTime;

    @Schema(description = "订单明细列表")
    private List<OrderDetailVo> orderDetailList;

    @Data
    @Schema(description = "订单明细项VO，包含单个商品的购买信息")
    public static class OrderDetailVo {

        @Schema(description = "订单项ID", example = "20001")
        private Long orderDetailId;

        @Schema(description = "商品图片URL", example = "https://example.com/img/product1.jpg")
        private String imageUrl;

        @Schema(description = "商品名称", example = "智能手机XPro")
        private String productName;

        @Schema(description = "商品规格名称", example = "128G/黑色")
        private String productSpecificationName;

        @Schema(description = "商品单价", example = "3999.00")
        private BigDecimal price;

        @Schema(description = "购买数量", example = "1")
        private Integer quantity;
    }
}
